package com.probiz.estoresa.content.web.action;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.validation.BindException;

import com.probiz.estore.common.model.content.Subscriber;
import com.probiz.estore.content.service.SubscriberManager;
import com.probiz.estore.core.controller.GenericStoreAdminController;

public class SubscriberController extends GenericStoreAdminController<Subscriber> {
    private SubscriberManager subscriberManager = null;

    public void setSubscriberManager(SubscriberManager inMgr) {
        this.subscriberManager = inMgr;
    }

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.GenericController#getEntityName(java.lang.Object)
	 */
	@Override
	protected String getEntityName(Subscriber entity) {
		return entity.getClass().getSimpleName();
	}


	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.BaseController#initController()
	 */
	@Override
	protected void initController() throws Exception {
		mgr = subscriberManager;
	}
	
	@Override
	protected Map<String,String> getSortMap(){
		Map<String,String> sortMap = new HashMap<String,String>();
		sortMap.put("1", "email");
		sortMap.put("2", "convert_gbk(newsletterGroup.name)");
		return sortMap;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.controller.GenericController#preSave(javax.servlet.http.HttpServletRequest,
	 *      java.lang.Object, org.springframework.validation.BindException)
	 */
	@Override
	protected void preSave(HttpServletRequest request, Subscriber entity, BindException errors) {
	}

}
